$(function() {
	flushLoginTicket();
    var orderIntTxnCd = $.trim($("#orderIntTxnCd").val());
    var casCustUserType = $("#casCustUserType").val();
    if(casCustUserType && casCustUserType != ""){
        switchGopay();
    }
    loginSubmit();
});


var switchGopay = function(){
    $(".tabsUl .tabsLabel").removeClass("cur");
    $("#gopayChannelSel").addClass("cur");
    showChannel("06");
}

function loginSubmit(){
	$("#gopayLoginSSOForm").submit();
}


var flushLoginTicket = function() {
	if($("#loginEmail").val()==""){
		var _services = 'service='+ encodeURIComponent(cashier_url+'/sec/pay/info.shtml?orderKey='+orderKey+'&orderId='+orderId);
//		var url = cas_server_url+'/login?' + _services+ '&get-lt=true&n=' + new Date().getTime();
		var url = 'http://authdev3.gopay.com.cn/login?' + _services+ '&get-lt=true&n=' + new Date().getTime();
	    var jsonpScript = document.createElement('script');
	    jsonpScript.setAttribute('src', url);
	    document.getElementsByTagName('head')[0].appendChild(jsonpScript);
	}
};


function callback(data){
	$("#lt").val(data.loginTicket);
}

var refreshAuthCode = function(){
	$("#authCode").val("");
    var timestamp = (new Date()).getTime();
    $("#authCodeImg").attr("src", ctx+"/captcha/default.jpeg?timestamp=" + timestamp);
};

